import request from '@/hooks/request'

const Api = {
  addCustomer: '/platform/customer/addCustomer', // 新增初语客服
  getCustomerList: '/platform/customer/getCustomerList', // 查询初语客服列表
  deleteCustomer: '/platform/customer/deleteCustomer', // 删除初语客服
  getRelevanceRobot: '/platform/customer/getRelevanceRobot', // 关联机器人
  getAssociatedRobot: '/platform/customer/getAssociatedRobot', // 已关联机器人
  customerRelevanceRobot: '/platform/customer/customerRelevanceRobot', // 客服关联微信
  customerCancelRelevanceRobot: '/platform/customer/customerCancelRelevanceRobot', // 客服取消关联微信
  editCustomerRemark: '/platform/customer/editCustomerRemark', // 客服取消关联微信
}

export const addCustomer = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addCustomer,
    data: parameter,
  })
}

export const getCustomerList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getCustomerList,
    data: parameter,
  })
}

export const deleteCustomer = (parameter: Record<any, any>) => {
  const formdata = new FormData()
  formdata.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteCustomer,
    data: formdata,
  })
}

export const getRelevanceRobot = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getRelevanceRobot,
    data: parameter,
  })
}

export const getAssociatedRobot = (parameter: Record<any, any>) => {
  const formdata = new FormData()
  formdata.append('customerId', parameter.customerId)
  formdata.append('channel', parameter.channel)
  return request({
    method: 'post',
    url: Api.getAssociatedRobot,
    data: formdata,
  })
}

export const customerRelevanceRobot = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.customerRelevanceRobot,
    data: parameter,
  })
}

export const customerCancelRelevanceRobot = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.customerCancelRelevanceRobot,
    data: parameter,
  })
}

export const editCustomerRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editCustomerRemark,
    data: parameter,
  })
}

